1. Technical Field
The present invention is generally directed to database systems. More specifically, the present invention is directed to a system, computer program product and method of automatically removing leading and trailing space characters from data being entered into a database system.
2. Description of Related Art
A database system is a computerized data storage and retrieval system. To manage the data in a database system, a database management system (DBMS) is used. A DBMS is a collection of programs that enables a user to enter, organize, and retrieve data from a database system.
Requests for information from a database system are generally made in the form of a query using a query language. Different DBMSs have different query engines that support different query languages. (A query engine is a search engine that searches a database system using keywords or phrases entered by a user.) However, one query language (i.e., Structured Query Language or SQL) has become standard since it has been adopted by both the American National Standards Organization (ANSI) and the International Standards Organization (ISO). Thus, the invention will be explained using SQL. However, it should be understood that the invention is not thus restricted. That is, the use of any other query language is well within the scope of the invention. Hence, SQL is used just for illustrative purposes only.
When a user sends an SQL query to a database system, the query will be executed and a result returned. The result ordinarily comprises a set of rows and columns as results are generally returned in the form of tables.
Data in a database system often includes a leading, a trailing or both leading and trailing space characters as space is often used as a delimiter to separate different pieces of data that are being entered in the database system. Further, a user entering data in the database system may inadvertently add some extra space characters at the beginning and/or end of a piece of data. Consequently, before data is presented to a user, leading and/or trailing space characters are usually removed.
Currently, TRIM functions, available in SQL, are used to remove leading and/or trailing space characters from data being presented to a user. Particularly, an application program developer has to integrate the TRIM function in the program such that the TRIM function operates on every column of data that is being retrieved or the user has to incorporate the TRIM function in the SQL request. This workaround causes the program or the SQL statements to be unreadable. Further, when functions are used on values in columns, table scans are performed instead of index searches. As is well known in the field, table scans are much slower than index searches. Thus, using the TRIM functions may adversely affect performance.
Consequently, what is needed are a system, computer program product and method of automatically removing leading and trailing space characters from data that is to be entered into a database system.